<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>学生添加页面</title>
    <link rel="stylesheet" type="text/css" href="../static/admin/layui2/css/layui.css"/>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo"><a href="guanliyuan-main.html" style="color: #009688;font-size: 25px;">管理员主页面</a></div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item"><a class="layui-icon layui-icon-user" style="color:#009688;font-size: 20px;text-align: center;" href="student-login.html">学生登录</a></li>
            <li class="layui-nav-item"><a class="layui-icon layui-icon-logout" style="color: #ff3c00;font-size: 20px;text-align: center;" href="guanliyuan-login.html">退出</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-username" style="font-size: 24px; color: #009688; margin-right: 16px"></i> 信息管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="guanliyuan-mimaChange.html"><i class="layui-icon layui-icon-edit" style="font-size: 24px; color: #009688; margin-right: 16px"></i>修改密码</a></dd>
                        <dd><a href="guanliyuan-add.html" class="layui-this"><i class="layui-icon layui-icon-add-circle" style="font-size: 24px; color: #009688; margin-right: 16px"></i>添加管理员</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-user" style="font-size: 24px; color: #009688; margin-right: 16px"></i>学生管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="guanliyuan-addstudent.html" ><i class="layui-icon layui-icon-add-circle" style="font-size: 24px; color: #009688; margin-right: 16px"></i>添加学生</a></dd>
                        <dd><a href="guanliyuan-deletestudent.html"><i class="layui-icon layui-icon-reduce-circle" style="font-size: 24px; color: #009688; margin-right: 16px"></i>删除学生</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-group" style="font-size: 24px; color: #009688; margin-right: 16px ;"></i>校友管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="guanliyuan-addalumni.html"><i class="layui-icon layui-icon-add-circle" style="font-size: 24px; color: #009688; margin-right: 16px"></i>添加校友</a></dd>
                        <dd><a href="guanliyuan-alumni.html"><i class="layui-icon layui-icon-friends" style="font-size: 24px; color: #009688; margin-right: 16px"></i>校友信息</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item layui-nav-iteme">
                    <a href="javascript:;"><i class="layui-icon layui-icon-rmb" style="font-size: 24px; color: #009688; margin-right: 16px"></i>奖学金管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="guanliyuan-addscholarship.html"><i class="layui-icon layui-icon-add-circle" style="font-size: 24px; color: #009688; margin-right: 16px"></i>添加奖学金</a></dd>
                        <dd><a href="guanliyuan-scholarship.html"><i class="layui-icon layui-icon-file" style="font-size: 24px; color: #009688; margin-right: 16px"></i>奖学金信息</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item layui-nav-iteme">
                    <a href="guanliyuan-examine.html"><i class="layui-icon layui-icon-survey" style="font-size: 24px; color: #009688; margin-right: 16px"></i>审批</a>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <div class="layui-anim layui-anim-scale" style="margin-top: 50px;margin-left: 50px;">
            <form class="layui-form layui-form-pane" name="form1" id="form1">
                <div class="layui-form-item">
                    <label class="layui-form-label">用户名</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" id="name" placeholder="请输入用户名" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-block">
                        <input type="password" name="password" lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">确认密码</label>
                    <div class="layui-input-block">
                        <input type="password" lay-verify="required|confirmPass" placeholder="确认密码" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux" id="ms" style="color: red;font-size: 20px"></div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">添加</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <div class="layui-footer layui-bg-green">

    </div>
</div>
<script src="../static/admin/layui2/layui.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['element','form','jquery','layer','laydate'], function(){
        var element = layui.element
        var form = layui.form
        laydate = layui.laydate
        layer = layui.layer
        $ =layui.jquery;

        form.render();
        form.verify({
            confirmPass:function(value,item){
                if($('input[name=password]').val() !== value)
                    return '两次密码输入不同！';
            }
        });
        form.on('submit(demo1)',function (data) {
            $.ajax({
                type:"POST",
                url:"/guanliyuan/addGuanliyuan",
                data:{
                    "name": data.field.name,
                    "password": data.field.password,
                },
                dataType:"json",
                success:function (res) {
                    if (res.flag){
                        layer.alert('添加成功', {icon: 1,time: 20000});
                        window.location.href="guanliyuan-add.html";
                    }else {
                        $("#ms").html(res.msg);
                    }
                }
            })
            return false;
        });
    });
</script>
</body>

</html>